home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-09-02 | 2.0 KB | 62 lines | [TEXT/CCL2] |
- ;;; load-fasl.lisp
- ;;;
- ;;; Paul McCartney, Spring 1992
- ;;;
- ;;; Copyright © 1992 Paul McCartney. All Rights Reserved.
- ;;;
- ;;; Washington University Medical Informatics Training Program
- ;;;
- ;;; DESCRIPTION:
- ;;;
- ;;; The "load-fasl" function is intended to be a time-saving load function.
- ;;;
- ;;; USE:
- ;;;
- ;;; load-fasl
- ;;;
- ;;; Given the name of a .lisp file, it checks to see if there is a corresponding .fasl
- ;;; file. If there isn't, or if the .lisp file is newer than the .fasl file, then the
- ;;; .lisp file is compiled. The .fasl file is then loaded.
- ;;;
- ;;; The destination of the .fasl file can be either the directory where the .lisp file
- ;;; exists, or some other directory (useful if you like your fasl files in a
- ;;; different directory than your source code).
- ;;;
- ;;; E.G. (load "HD:code:foo.lisp") -> (load-fasl "HD:code:foo.lisp")
- ;;; or -> (load-fasl "HD:code:foo.lisp" "HD:code:FASL:")
- ;;;
- ;;; HISTORY:
- ;;;
- ;;; 6/12/90 Created. - PM
- ;;; 4/5/92 Updated to MCL 2.0. - PM
- ;;; 6/25/92 Added the optional fasl destination. - PM
- ;;;
-
- (in-package :ccl)
-
- (eval-when (:compile-toplevel :load-toplevel :execute)
- (export '(load-fasl)
- :ccl))
-
-
- (defun load-fasl (filename &optional fasl-directory
- &key (verbose *load-verbose*) (print *load-print*))
- (let* ((default-pathname (compile-file-pathname filename))
- (new-file (if fasl-directory
- (merge-pathnames (mac-file-namestring default-pathname) fasl-directory)
- default-pathname)) )
- (cond ((modified-text-file filename new-file)
- (format t "~%;Compiling: ~s" filename)
- (compile-file filename :output-file new-file :load t))
- (t (load new-file :verbose verbose :print print))) ))
-
-
- ;;; Check to see that the text file was modified after the fasl file
- ;;; Return t if the text file is newer, or no fasl file exists.
- ;;;
- (defun modified-text-file (file new-file)
- (or (not (probe-file new-file))
- (> (file-write-date file) (file-write-date new-file))))
-
-
- (provide :load-fasl)